#!/usr/bin/env python
# encoding: utf-8
"""
test.py

Created by  on 2008-10-18.
Copyright (c) 2008 __MyCompanyName__. All rights reserved.
"""

import sys
import os
import traceback
from subprocess import Popen, call, PIPE

def isRunning(name):
	try:
		pf = file(name,'r')
		pid = int(pf.read().strip())
		return pid
	except Exception, e:
		pass
		
		
def execute(path ,name,arg):
	try:
		command = path+name+ ' ' + arg
		print >>sys.stderr, "Command:",command 
		result = os.popen(command).read()
		print result
		print >>sys.stderr, "Res:", result
	except Exception, e:
		err ="\n".join(traceback.format_exception(*sys.exc_info()))
		print >>sys.stderr, "Execution :", err
		return None


if __name__ == '__main__':
	pass


